﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WSPay.Common.Data
{
    public static class UnitOfWorkExtension
    {
        public static IRepository<T> D<T>(this IUnitOfWork unitOfWork) where T:IEntity
        {
            return unitOfWork.Repository<T>();
        }

        public static IQueryable<T> Q<T>(this IUnitOfWork unitOfWork) where T:IEntity
        {
            return unitOfWork.Repository<T>().ReadQuery();
        }

        public static IEnumerable<T> QuerySql<T>(this IUnitOfWork unitOfWork,string sql, params object[] parameters) where T:class{

            return unitOfWork.QuerySql<T>(typeof(T), sql, parameters) as IEnumerable<T>;

        }
    }
}
